package kr.co.mcshop.review;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ReviewBoardService {

	@Autowired
	private SqlSession sqlSession;

	public List<ReviewBoard> getAllBoard(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.getAllBoard(map);
	}

	public int insert(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.insertBoard(map);
	}

	public int update(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.updateBoard(map);
	}

	public int delete(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.deleteBoard(map);
	}

	public int updateCount(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.updateCount(map);
	}

	public List<ReviewBoard> searchtitle(Map map) {
		ReviewBoardMapper mapper = sqlSession
				.getMapper(ReviewBoardMapper.class);
		return mapper.searchtitle(map);
	}

	public List<ReviewBoard> searchuserid(Map map) {
		ReviewBoardMapper mapper = sqlSession
				.getMapper(ReviewBoardMapper.class);
		return mapper.searchuserid(map);
	}
	
	public int deletereview(Map map) {
		ReviewBoardMapper board = sqlSession.getMapper(ReviewBoardMapper.class);
		return board.deletereview(map);
	}
	
	
}
